<template>
	<view class="steps">
		<view class="Steps">
			<view class="item" v-for="(item,index) in options" :key="index">
				<view class="box">
					<view class="Line1" :style="{'background':item.day>active ?'#818283' : ''}"></view>
					<view class="options" :style="{'background':item.day>active ?'#818283' : ''}">
						<view class="icon" v-if="item.day_str == '今天' && is_sign_in">
							<image src="../../static/CheckBox.png" mode=""></image>
						</view>
						<view v-else>
							+{{item.jifen}}
						</view>
						
					</view>
					
					<view class="Line1" :style="{'background':item.day>active ?'#818283' : ''}"></view>
				</view>
				<view class="title">
					{{item.day_str}}
				</view>
			</view>
		</view>
		
		<view class="btn1"  v-if="is_sign_in">
			已签到
		</view>
		<view class="btn" v-else @click="getuserSignIn()">
			立即签到
		</view>
		<view class="text" v-if='active>0'>
			已连续签到{{active}}天
		</view>
	</view>
	
</template>
<script>
	const app = getApp();
	export default {	
		name: "steps",
		props: {
			options: {
				type: Array,
				default: ''
			},
			active:{
				type: Number,
				default: 0
			},
			is_sign_in:{
				type:Number,
				default:0
			}
		},
		data() {
			return {
			}
		},
		created(){

		},
		onLoad(options){
		},
		onShow() {
			
		},
		onReady() {
		},
		methods: {
			//签到信息
			getuserSignIn() {
				let _this = this
				app._post_form('Jadegoods/userSignIn', {}, function(result) {
					if (1 == result.code) {
						console.log(result)
						_this.$emit('update:active',result.data.continue_days)
						_this.$emit('update:is_sign_in',1)
						
						app.showToast(result.msg)
					}else{
						app.showToast(result.msg)
					}
				}, null, function() {
					// 解除按钮禁用
					uni.stopPullDownRefresh();
					// app.showError(result.msg);
				});
			},
		}
	}
</script>
<style lang="scss" scoped>
	.Steps{
		width: 100%;
		// height: 200rpx;
		background-color: #1F2021;
		color: #fff;
		display: flex;
		align-items: center;
		
		font-size: 24rpx;
		.item{
			display: flex;
			flex-direction: column;
			align-items: center;
			overflow: hidden;
			.box{
				display: flex;
				align-items: center;
				.Line1{
					width: 33rpx;
					height: 8rpx;
					background-color: #B1934C;
				}
				.options{
					width: 50rpx;
					height: 50rpx;
					color: #fff;
					background-color: #B1934C;
					border-radius: 50%;
					font-size: 24rpx;
					line-height: 50rpx;
					// text-align: center;
					display: flex;
					justify-content: center;
					.icon{
						width: 32rpx;
						height: 22rpx;
						image{
							width: 100%;
							height: 100%;
						}
					}
				}
				
			}
			.title{
				margin-top: 40rpx;
			}
			
		}
	}
	.btn{
		
		margin: 60rpx auto;
		// margin-top: 60rpx;
		width: 638rpx;
		height: 96rpx;
		background: linear-gradient(90deg, #D2B07C 0%, #F8DEC2 100%);
		box-shadow: inset 0 4rpx 20 0 rgba(255,255,255,0.46);
		border-radius: 10rpx;
		line-height: 96rpx;
		text-align: center;
		color: #fff;
	}
	.btn1{
		
		margin: 60rpx auto;
		// margin-top: 60rpx;
		width: 638rpx;
		height: 96rpx;
		background: linear-gradient(90deg, #3e3b3b 0%, #6d6b69 100%);
		box-shadow: inset 0 4rpx 20 0 rgba(255,255,255,0.46);
		border-radius: 10rpx;
		line-height: 96rpx;
		text-align: center;
		color: #fff;
	}
	.text{
		text-align: center;
		font-size: 26rpx;
		color: #B4BAC1;
	}
</style>
